
#include "reg52.h"

typedef unsigned int u16;	//????I??????????????????
typedef unsigned char u8;

//????LED1???
sbit LED1=P2^0;


void delay_10us(u16 ten_us)
{
	while(ten_us--);	
}


void time0_init(void)
{ 
	TMOD|=0X01;//?????????0g??????????1
	TH0=0XFC;	//?????????????????1ms
	TL0=0X18;	
	ET0=1;//???????0???????
	EA=1;//???????
	TR0=1;//???????		
}


void main()
{	
	time0_init();//?????0???????

	while(1)
	{			
							
	}		
}

void time0() interrupt 1 //?????0??????
{
	static u16 i;//?????????i
	TH0=0XFC;	//?????????????????1ms
	TL0=0X18;
	i++;
	if(i==1000)
	{
		i=0;
		LED1=!LED1;	
	}						
}